package com.turing.post.common.impl;

import java.util.List;

import javax.ejb.Local;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import com.turing.post.common.util.Global;
import com.turing.post.common.util.GlobalDao;

@Stateless(mappedName = "common.impl.GlobalDaoImpl")
@Remote
@Local
public class GlobalDaoImpl implements GlobalDao {
	
	/**
	 * 实体管理器
	 * 
	 * @see javax.persistence.EntityManager
	 */
	@PersistenceContext
	protected EntityManager _em;
	
	@SuppressWarnings("unchecked")
	@Override
	public List<Global> getGlobalList() {
		return _em.createNativeQuery(
				"select * from Global order By id desc",
				Global.class).getResultList();
	}
}
